import http from '@/plugins/aixos'
import { acrossModel } from '@/types/model'

export const findAllAcross = (args: Record<string, any>) => {
  const url =
    '/across?' +
    Object.entries(args)
      .map(([key, value]) => `${key}=${value}`)
      .join('&')

  return http.request<acrossModel[]>({
    url,
    method: 'GET',
  })
}

export const addAcross = (data: acrossModel) => {
  return http.request<acrossModel>({
    url: `/across/`,
    data,
    method: 'POST',
  })
}

export const delAcrosss = async (id: number) => {
  return await http.request({
    url: `/across/across/${id}`,
    method: 'DELETE',
  })
}
